#include "Shared.fxh"

float4 depth_vs(
	float4 iPos : POSITION,
	
	out float3 oEye : TEXCOORD0
	) : POSITION
{
	oEye = mul( iPos, MatModelView ).xyz;

	return mul( iPos, MatMvp );
}

float4 depth_ps(
	float3 iEye : TEXCOORD0
	) : COLOR
{
	return (length( iEye ) - DepthRange.x) / (DepthRange.y - DepthRange.x);
}

technique t0
{
	pass depth
	{
		VertexShader = compile vs_2_0 depth_vs();
		PixelShader = compile ps_2_0 depth_ps();
		
		AlphaBlendEnable = False;
		AlphaTestEnable = False;
		ZEnable = True;
		ZFunc = LessEqual;
		ZWriteEnable = True;
	}
}